<template>
    <div class="bottom-bar">
     <div class="bottomBar-left">
         <Check-Button class="cart-bottomBarBtn"/>
         <span>全选</span>
     </div>
     <div class="bottomBar-right">
         <span>合计{{ totalPrice }}</span>
        <span class="btn submit disabled">结算({{ checkLength }})</span>
     </div>
   </div>
</template>
<script>

import CheckButton from 'components/content/checkButton/CheckButton'

import{ mapGetters } from 'vuex'
export default {
    name: 'CartBottomBar',
     components: {
         CheckButton
     },
     computed: {
         ...mapGetters(['cartList']),
        totalPrice() {
          return '￥' + this.cartList.filter(item => {
              if(item.checked){
                return item.checked
              }else{
                  console.log('NO');
              }
            //    return item.checked
          }).reduce((preValue, item) => {
              return preValue + item.jiage * item.count
          },0).toFixed(2)
        },
        checkLength() {
            return this.cartList.filter(item => item.checked).length
        }
     },
}
</script>

<style scoped>
    .bottom-bar {
        display: flex;
        align-items: center;
        height: 54px;
        background-color: #fff;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 49px; 
        padding: 0 12px
    }
    .bottomBar-left{
        
        display: flex;
        align-items: center;
    }
    .cart-bottomBarBtn{
        margin-right: 5px;
    }
    .bottomBar-left span{
        font-size: 12px;
        flex: 1;
    }
    .bottomBar-right{
        flex: 1;
       display: flex;
      -webkit-box-align: center;
      -webkit-box-pack: end;
      align-items: center;
      justify-content: flex-end;
      overflow: hidden;
    }
    .bottomBar-right span{
        font-size: 14px;
    }
    .bottomBar-right .disabled {
        color: rgba(255, 255, 255, 0.5);
    }
    .bottomBar-right .submit {
      background-image: -webkit-linear-gradient(left, #FF9000 0%, #FF5000 98%);
      background-image: linear-gradient(90deg, #FF9000 0%, #FF5000 98%);
      font-size: 15px;
      line-height: 15px;
      padding: 8px 18px;
      text-align: center;
      border-radius: 80px;
      color: #FFFFFF;
      white-space: nowrap;
      margin-left: 10px;
      }
</style>